<template>
  <div>
    <ElDialog
    v-model="visible"
    title="确认你要提交的信息"
    width="400px"
  >
   <ul>
    <li>编号：{{ submitcondition.subexponseCode }}</li>
    <li>申请人：{{ submitcondition.applier }}</li>
    <li>申请部门：
        <span v-if="submitcondition.department==='sale'">销售部</span>
        <span v-if="submitcondition.department==='duration'">市场部</span>
        <span v-if="submitcondition.department==='finance'">财务部</span>
    </li>
    <li>申请原因：{{ submitcondition.useto }}</li>
    <li>申请金额：{{ submitcondition.money }}</li>
    <li>申请时间：{{ time(new Date()) }}</li>
   </ul>
    <template #footer>
      <span class="dialog-footer">
        <ElButton @click="visible = false">取消</ElButton>
        <ElButton type="primary" @click="submit()">
          提交
        </ElButton>
      </span>
    </template>
  </ElDialog>
  </div>
</template>
<script lang="ts">
import type { subexponse } from '@/views/SubExponse.vue';

/**
 * 页面核心数据结构体说明文档
 *
 *
 */
// import from

export default {
  name: "SubExponseSubmit",
  props: {
    sampleP: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      sampleD: 'value',
      visible: false,
      submitcondition:{} as subexponse
    }
  },
  computed: {
    /* sampleC() {
      return this.sampleD + "--";
    }, */
  },
  created() {},
  mounted() {},
  methods: {
    // sampleM() {},
    async submit() {
        await axios({
                method: "PUT",
                url: "http://127.0.0.1:7001/subexponse/submit/applier/"+this.submitcondition.subexponseCode,
              }).then(
                (res) => {
                  console.log(res.data);
                  ElMessage.success('提交成功')
                  this.$emit('putsubmit')
                  this.visible = false
                },
                (error) => {
                  console.log(error.response.data);
                }
              );
    },
      time(date: Date) {
          const datec =
            date.getFullYear() +
            '年' +
            (date.getMonth() + 1) +
            '月' +
            date.getDate() +
            '日' +
            date.getHours() +
            '时' +
            date.getMinutes()+
            '分'
          //用法
          // <ElTableColumn> <template #default="{ row }">
          //     <span>{{ time(new Date(row.applytime)) }}</span>
          //   </template></ElTableColumn>
          return datec
        }
  },
  watch: {
    // sampleP(n, o) {},
  }
}
</script>

<!--<style scoped>-->
<style lang="scss" scoped></style>
